#!/bin/sh
set -e

case "$1" in
    configure)

    echo "changing permission of prey config and prey.sh"
    chmod a+x /opt/prey/platform/linux/config
    chmod a+x /opt/prey/platform/linux/prey-config.py
    chmod a+x /opt/prey/prey.sh
    chmod a+x /opt/prey/run
    chmod a+x /opt/prey/bin/*
    echo "Starting preyd ..."
    [[ -e /etc/init/apps/preyd.conf ]] && initctl start apps/preyd
    ;;

    abort-upgrade|abort-remove|abort-deconfigure)
    ;;

    *)
        echo "postinst called with unknown argument \`$1'" >&2
        exit 1
    ;;
esac

# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.

#DEBHELPER#

exit 0
